home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE15 / CPPCLASS / cpp32 / CPPDLL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-17  |  942 b   |  47 lines

  1. #include <windows.h>
  2. #include <dos.h>
  3. #include <stdio.h>
  4. #include "delevent.h"
  5.  
  6.  
  7. class  TDLLClass{
  8.   char Buffer[80];
  9.   int InternalValue;
  10.   TEvent FEvent;
  11.  
  12.   virtual void  _pascal SetValue(int Info){InternalValue = Info;}
  13.   virtual int   _pascal GetValue(){return InternalValue;}
  14.   virtual void  _pascal SetEvent(TEvent func){FEvent = func;};
  15.  
  16.  
  17. public:
  18.   TDLLClass():InternalValue(0){FEvent.Code = NULL;};
  19.  
  20.   virtual void  _pascal ShowThevalue()
  21.   {
  22.      wsprintf(Buffer, "The value %d\nCOM to da Max!!!!",InternalValue);
  23.      MessageBox(NULL,Buffer,"From The C++ DLL",MB_OK);
  24.   }
  25.  
  26.   virtual void  _pascal DoEvent()
  27.   {
  28.          if (FEvent.Code != NULL)
  29.                 (FEvent.Code)((const void *)this,FEvent.Self);
  30.   }
  31. };
  32.  
  33. extern "C" {
  34.  
  35. TDLLClass* _cdecl _export ConstructClass()
  36. {
  37.   return new TDLLClass;
  38. };
  39.  
  40. void _cdecl _export DestructClass(TDLLClass *DLLClass)
  41. {
  42.   if (DLLClass != NULL)
  43.          delete DLLClass;
  44. };
  45. }
  46.  
  47.